package com.humanSource.code.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.humanSource.code.entity.DepInfoEntity;
import com.humanSource.code.service.DepInfoService;
import com.utils.PageUtils;
import com.utils.R;



/**
 * 
 *
 * @author mordenx
 * @email #####
 * @date 2021-07-12 21:10:54
 */
@RestController
@RequestMapping("code/depinfo")
public class DepInfoController {
    @Autowired
    private DepInfoService depInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
        public R list(@RequestParam Map<String, Object> params){
        PageUtils page = depInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{depId}")
       public R info(@PathVariable("depId") Long depId){
		DepInfoEntity depInfo = depInfoService.getById(depId);

        return R.ok().put("depInfo", depInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
       public R save(@RequestBody DepInfoEntity depInfo){
		depInfoService.save(depInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
        public R update(@RequestBody DepInfoEntity depInfo){
		depInfoService.updateById(depInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
        public R delete(@RequestBody Long[] depIds){
		depInfoService.removeByIds(Arrays.asList(depIds));

        return R.ok();
    }

}
